package fm.controller;

import fm.exception.BizException;
import fm.web.MediaTypes;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by 61741 on 2018/2/2.
 */
@Controller
@RequestMapping("/articledetail")
public class ArticleDetailController extends BaseController{
    @RequestMapping("/index/{article_id}")
    public String index(ModelMap modelMap, @PathVariable String article_id){
        modelMap.put("article_id",article_id);
        return  "portal/article";
    }
   @ResponseBody
    @RequestMapping(value = "",method = RequestMethod.POST,produces = MediaTypes.JSON_UTF_8)
    public Map addArticleComment (String co){
        Map res = new HashMap();
        try{


            res.put("data","");
            this.success(res);
        }catch (BizException ex){
            LOGGER.error("发生错误:",ex);
            this.failed(res,ex.getMessage());
        }catch (Exception ex){
            LOGGER.error("发生异常",ex);
            this.failed(res,"服务器发生了未知的错误，请联系管理员或者开发者解决!");
        }
        return res;
    }
}
